<!DOCTYPE html>
<html>
<head>
    <title>MillionaireMatch</title>
    <meta http-equiv=Content-Type content="text/html" charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="telephone=no" name="format-detection">
</head>
<body>
</body>
    <script src="http://images.commercialless.com/seajs/2.3.0/sea.js"></script>
    <script src="http://images.commercialless.com/seajs/2.3.0/seajs-css.js"></script>
    <script src="http://images.commercialless.com/seajs/2.3.0/seajs-text.js"></script>
    <script>
    // For development
    if (location.href.indexOf("?dev") > 0) {
        var engine = 'nmm',
        mainSite = 'http://www.millionairematch.com/',
        domain = 'http://www.nmm.com',
        remoteResource = 'http://static.nmm.com',
        messageName = 'masonsoft';
    }  else {
        var engine = 'nmm',
        mainSite = 'http://www.millionairematch.com/',
        domain = 'http://mobile.masonsoft.com',
        remoteResource = 'http://static.masonsoft.com',
        messageName = 'millionairematch';
    }

    seajs.config({
        alias: {
            "lang" : "I18N/"+engine+'/'+getLocale()+".js",
            "$": "zepto/zepto.min.js",
            "util": "util/util.js",
            "share": "static/logic/"+engine+"/src/share.js",
            "underscore": "gallery/underscore/1.4.4/underscore.js",
            "backbone": "gallery/backbone/1.0.0/backbone.js",
            "msgcore": "candy/message.core.js",
            "candy": "candy/candy.js",
        },

        preload: [
            '$','backbone','underscore'
        ],

        paths: {
            'gallery': remoteResource+'/sea-modules/gallery',
            'static': remoteResource
        },

        vars: {
            'locale': getLocale(),
            'baseSea': remoteResource+'/sea-modules/', 
            'resourceUrl': domain+'/resource/'+engine+'/',
            'apiUrl': domain+'/apis/',
            'apiAccessUrl': domain+'/apis/'+getCookie('session_id')+'/'
        },

        'map': [
                [/^(.*\.(?:css|js))(.*)$/i, '$1?v='+Math.random()]
                //[/^(.*\.(?:css|js))(.*)$/i, '$1?v=1.0']
        ],

        debug: true,

        base: remoteResource+'/sea-modules/',

        charset: 'utf-8'
    });


    function getLocale(){
        var locale = getCookie('siteLocale');
        return locale == '' ? 'en' : local;
    };

    function getCookie(name) {
        var search = name + "=",offset,end; 
        if(document.cookie.length > 0) { 
            offset = document.cookie.indexOf(search);
            if(offset != -1) { 
                offset += search.length;
                end = document.cookie.indexOf(";", offset); 
                if(end == -1) {
                    end = document.cookie.length;
                };
                return decodeURI(document.cookie.substring(offset, end));
            } 
        }
        return "";
    };

    seajs.use(['$','backbone','underscore','util','share','lang','msgcore'],function($,backbone,underscore,util,share,lang,msgcore){
        //Global
        window.Backbone = backbone;
        window._ = underscore;
        window.$ = $;
        window.util = util;
        window.share = share;
        window.lang = lang;
        seajs.use(remoteResource+"/logic/"+engine+"/src/main");
    })

    </script>
</html>
